package com.zhkj.txg.module.find.model

import com.zhkj.lib.http.BaseApiService
import com.zhkj.lib.http.BaseResponse
import com.zhkj.txg.module.find.entity.*
import io.reactivex.Observable
import retrofit2.http.*

interface FindApi : BaseApiService {
    @GET("api/find/index")
    fun findList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") numb: Int
    ): Observable<FindListResponse>

    @GET("api/find/detail")
    fun findArticleDetail(
        @Query("token") token: String,
        @Query("id") id: Int
    ): Observable<FindArticleResponse>

    @GET("api/find/getCommentList")
    fun findArticleCommentList(
        @Query("token") token: String,
        @Query("id") id: Int,
        @Query("page") page: Int,
        @Query("rows") numb: Int
    ): Observable<FindCommentResponse>

    @FormUrlEncoded
    @POST("api/find/submitComment")
    fun commentCommit(
        @Field("token") token: String,
        @Field("id") id: Int,
        @Field("comment_id") commentId: Int,
        @Field("content") content: String
    ): Observable<BaseResponse>

    @FormUrlEncoded
    @POST("api/find/like")
    fun likeFind(
        @Field("token") token: String,
        @Field("id") id: Int,
        @Field("comment_id") commentId: Int,
        @Field("type") type: Int //类型 0发现内容 1评论
    ): Observable<BaseLikeResponse>

    @FormUrlEncoded
    @POST("api/find/delComment")
    fun deleteComment(
        @Field("token") token: String,
        @Field("id") id: Int,
        @Field("comment_id") commentId: Int
    ): Observable<BaseLikeResponse>

    @GET("api/find/getRelationGoods")
    fun associateProductList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") numb: Int,
        @Query("search") searchKey: String = ""
    ): Observable<AssociateProductResponse>

    @FormUrlEncoded
    @POST("api/find/submit")
    fun publishArticle(
        @Field("token") token: String,
        @Field("content") content: String,
        @Field("images") images: String,
        @Field("goods_id") goodsId: Long
    ): Observable<BaseResponse>
}